#ifndef _CODE_H_
#define _CODE_H_
#include "table.h"

#define BBLOCK_NUM     512
#define REG_NUM        6
#define RUN_STACK_SIZE 256

typedef enum Register {
    EAX = 0, ECX, EDX,
    EBX, ESI, EDI,
} Register;

typedef enum RegState {
    FREE = F_REGSTATE, OCCUPIED,
} RegState;

//typedef enum Opcode {
//    ADD_OP = F_OPCODE, MINUS_OP, MUL_OP, DIV_OP,
//    /*LSS, LEQ, GTR, GEQ, NEQ, DEQ,*/
//    IFLT_OP, IF_LET_OP, IFMT_OP, IFMET_OP,
//    IFNE_OP, IFEQ_OP, FUNC_OP,
//    ASSIGN_OP, JMP_OP, PARA_OP, CALL_OP, SCANF_OP, PRINTF_OP, 
//    RETV_OP, RETN_OP,
//} Opcode;

//typedef enum InstCode {
//	ADD, SUB, MUL, DIV,
//	JB, JBE, JA, JAE,
//	JNE, JE, CALL,
//	MOV, JMP, CALL,
//	RET,
//} InstCode;

typedef struct RegVar {
    RegState rs;
    Register rg;
    NormalElement *ne;
} RegVar;

extern void gen_assembly_code();
extern const char REGISTER_STRING[][4];
#endif